Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(display): Add ability to set display on/off pin. #2814

Merged

Conversation

petejohanson
Copy link
Contributor

@petejohanson petejohanson commented Feb 7, 2025

Zephyr is still working on the plan upstream for generically controlling display "backlight" pins with GPIO/PWM, so in the meantime, add our own chosen property zmk,display-led that is set to an LED device child to allow blanking/unblanking of devices that use a dedicated backlight control pin.

Basically looks like this in the devicetree:

/ {
    chosen {
        zephyr,display = &vik_st7789v;
        zmk,display-led = &disp_led;
    };

    leds {
        compatible = "gpio-leds";

        disp_led: disp_led {
            gpios = <&vik_conn 3 GPIO_ACTIVE_HIGH>;
            label = "Display LED";
        };
    };
};

And then you need to enable the CONFIG_LED=y Kconfig flag to build that driver subsystem in.

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.
  • Includes any necessary documentation changes.

@petejohanson petejohanson added enhancement New feature or request displays labels Feb 7, 2025
@petejohanson petejohanson self-assigned this Feb 7, 2025
@petejohanson petejohanson requested review from a team as code owners February 7, 2025 23:12
@@ -62,3 +62,12 @@ See the Devicetree bindings for your display. Here are the bindings for common d
- [SSD1306 (spi)](https://docs.zephyrproject.org/3.5.0/build/dts/api/bindings/display/solomon,ssd1306fb-spi.html)

A full list of drivers provided by Zephyr can be found in [Zephyr's Devicetree bindings index](https://docs.zephyrproject.org/3.5.0/build/dts/api/bindings.html).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this is how we normally document these in config pages: https://zmk.dev/docs/config/kscan#devicetree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Missed that. I'll update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caksoylar Tweaked.

@Nick-Munnich
Copy link
Contributor

Would it not make more sense for &disp_led to be attached to the &vik_st7789v node? Or does Zephyr not support multiple displays from one device anyway, so it doesn't matter.

@petejohanson
Copy link
Contributor Author

Would it not make more sense for &disp_led to be attached to the &vik_st7789v node? Or does Zephyr not support multiple displays from one device anyway, so it doesn't matter.

It does not support more than one. Upstream Zephyr folks are exploring how to more fully integrate it, but there's various pros/cons to a more invasive change, so this is the pragmatic way to support this today, with existing drivers, that won't cause conflicts once upstream settles on an approach.

Zephyr is still working on the plan upstream for generically controlling
display "backlight" pins with GPIO/PWM, so in the meantime, add our
own chosen property `zmk,display-led` that is set to an LED device child
to allow blanking/unblanking of devices that use a dedicated backlight
control pin.
@petejohanson petejohanson force-pushed the display/led-on-off-control branch from 25b8e28 to 68cd0fc Compare February 8, 2025 00:12
@petejohanson petejohanson merged commit 627e6db into zmkfirmware:main Feb 8, 2025
50 checks passed
tjmitchem pushed a commit to tjmitchem/zmk that referenced this pull request Feb 12, 2025
Zephyr is still working on the plan upstream for generically controlling
display "backlight" pins with GPIO/PWM, so in the meantime, add our
own chosen property `zmk,display-led` that is set to an LED device child
to allow blanking/unblanking of devices that use a dedicated backlight
control pin.
tjmitchem pushed a commit to tjmitchem/zmk that referenced this pull request Feb 13, 2025
Zephyr is still working on the plan upstream for generically controlling
display "backlight" pins with GPIO/PWM, so in the meantime, add our
own chosen property `zmk,display-led` that is set to an LED device child
to allow blanking/unblanking of devices that use a dedicated backlight
control pin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
displays enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants